package com.knowledge.graph.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.knowledge.graph.model.entity.Grade;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface GradeMapper extends BaseMapper<Grade> {

    @Insert("insert into grade(name,description,teacher_id,member) values(#{name},#{description},#{teacherId},#{member})")
    @Options(useGeneratedKeys = true,keyProperty = "id",keyColumn = "id")
    public int insertGrade(Grade grade);

    @Select("select * from grade where teacher_id = #{teacherId}")
    public List<Grade> selectByTeacherID(Integer teacherID);

    @Select("select id from grade where invitation_code = #{text}")
    Long selectByCode(String text);
}
